#!/bin/sh
# - test

xinitrc=$LKP_SRC/programs/pm-qa/pm-qa.xinitrc

if [ "$test" = "all" ] || [ "$test" = "thermal" ]; then
	mkdir -p		/tmp/.X11-unix
	chmod 1777		/tmp/.X11-unix
	chown root:root		/tmp/.X11-unix

	# have a delay after start cpu_heat to make sure cpu_heat have been started when cpu is very busy
	[ -e $BENCHMARK_ROOT/pm-qa/thermal/thermal_03.sh ] && sed -i -e '/\$CPU_HEAT_BIN/a sleep 3' $BENCHMARK_ROOT/pm-qa/thermal/thermal_03.sh
	[ -e $BENCHMARK_ROOT/pm-qa/thermal/thermal_06.sh ] && sed -i -e '/\$CPU_HEAT_BIN/a sleep 3' $BENCHMARK_ROOT/pm-qa/thermal/thermal_06.sh
	
	xrandr > /dev/null 2>&1
	if [ $? -eq 0 ];then
                xinit $xinitrc
        else
                Xvfb :1 -screen 0 1024x768x24 &
                export DISPLAY=:1
                $xinitrc
        fi
else
	$xinitrc
fi
